package com.cleanvegetable;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import lombok.extern.slf4j.Slf4j;

/**
 * 应用启动类
 *
 * @author cleanvegetable
 * @date 2024/02/24
 */
@Slf4j
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@MapperScan("com.cleanvegetable.**.mapper")
@EnableConfigurationProperties
public class CleanVegetableApplication {
    
    /**
     * 应用程序入口方法
     * @param args 启动参数
     */
    public static void main(String[] args) {
        // 创建并运行应用程序
        SpringApplication application = new SpringApplication(CleanVegetableApplication.class);
        application.setAdditionalProfiles("dev");
        ConfigurableApplicationContext context = application.run(args);
        Environment env = context.getEnvironment();
        
        // 打印关键配置信息
        log.info("===================应用启动成功===================");
        log.info("应用名称: {}", env.getProperty("spring.application.name"));
        log.info("服务端口: {}", env.getProperty("server.port"));
        log.info("运行环境: {}", String.join(", ", env.getActiveProfiles()));
        log.info("===============================================");
    }
} 